package pl.edu.project.view;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.HeadlessException;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class CalendarEventsFrame extends JPanel {

	private static final long serialVersionUID = 5634634692260355470L;

	private JButton addEvent;
	private JButton delEvent;
	private JButton editEvent;
	private JList eventList;
	private DefaultListModel eventListModel;

	public CalendarEventsFrame() throws HeadlessException {
		super();
		init();

	}

	private void init() {
		// przyciski
		addEvent = new JButton("Dodaj");
		// addEvent.addActionListener(new ActionAdd());
		editEvent = new JButton("Edytuj");
		// editEvent.addActionListener(new ActionEdit());
		delEvent = new JButton("Usu�");
		// delEvent.addActionListener(new ActionDelete());
		// dodanie przyciskow do layoutu
		JPanel buttonsPanel = new JPanel();
		buttonsPanel.add(addEvent);
		buttonsPanel.add(editEvent);
		buttonsPanel.add(delEvent);
		// dodanie layoutu do okna
		this.add(buttonsPanel);

		// lista zdarzen
		eventListModel = new DefaultListModel();
		eventList = new JList(eventListModel);
		// eventList.setCellRenderer(new ListElementCellRenderer());
		// przewijanie listy
		JScrollPane listScroller = new JScrollPane(eventList);
		listScroller.setPreferredSize(new Dimension(400, 80));
		// dodanie listy do okna
		JPanel eventsPanel = new JPanel(new FlowLayout());
		eventsPanel.add(listScroller);
		this.add(eventsPanel);
	}

	public JButton getAddEvent() {
		return addEvent;
	}

	public void setAddEvent(JButton addEvent) {
		this.addEvent = addEvent;
	}

	public JButton getDelEvent() {
		return delEvent;
	}

	public void setDelEvent(JButton delEvent) {
		this.delEvent = delEvent;
	}

	public JButton getEditEvent() {
		return editEvent;
	}

	public void setEditEvent(JButton editEvent) {
		this.editEvent = editEvent;
	}

	public JList getEventList() {
		return eventList;
	}

	public void setEventList(JList eventList) {
		this.eventList = eventList;
	}

	public DefaultListModel getEventListModel() {
		return eventListModel;
	}

	public void setEventListModel(DefaultListModel eventListModel) {
		this.eventListModel = eventListModel;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}
